import request from '@/utils/request'

/**
 * 获取部门列表
 */
export function getDepartments() {
  return request({
    url: '/company/department'
  })
}

/**
 * 根据ID删除部门
 * @param {*} id 部门id
 */
export function removeDepartments(id) {
  return request({
    url: '/company/department/' + id,
    method: 'DELETE'
  })
}

/**
 *新增部门
 * @param {Object} data {code	 introduc manager name	pid}
 */
export function addDepartments(data) {
  return request({
    url: '/company/department',
    method: 'post',
    data
  })
}
/**
 * 根据ID查询部门详情
 * @param {*} id
 */
export function getDepartmentsById(id) {
  return request({
    url: '/company/department/' + id,
    method: 'GET'
  })
}
/**
 * 根据ID修改部门详情
 * @param {*} data
 */
export function editDepartmentsById(data) {
  return request({
    url: '/company/department/' + data.id,
    method: 'PUT',
    data
  })
}
